from UI.UI_browserWidget    import Ui_browserWidget
from PyQt4                  import QtCore, QtGui

class BrowserWidget(QtGui.QDialog,Ui_browserWidget,QtGui.QWidget):
    def __init__(self, url=''):
        super(BrowserWidget,self).__init__()
        self.setupUi(self)
        self.initFields(url)
        self.setEvents()
        
    def initFields(self, url):
        pass
    
    def setEvents(self):
        self.navigateButton.clicked.connect(self.setNewPage)
        
    def setNewPage(self):
        httpStart = 'http://'
        newUrl = self.lineEdit.text()
        if not newUrl.startsWith(httpStart):
            newUrl = httpStart+newUrl
        self.browserWebView.load(QtCore.QUrl(newUrl))
        